package com.etc.admin.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.etc.admin.dao.OrderMapper;
import com.etc.admin.dao.RoomMapper;
import com.etc.admin.service.RoomService;
import com.etc.entity.Room;
import com.etc.util.PageData;
@Service("roomService")
public class RoomServiceImpl implements RoomService{
	@Resource
  private RoomMapper roomMapper;
	@Resource
  private OrderMapper orderMapper;
	
	/**
	 * 分页
	 */
	@Override
	public PageData<Room> getRoomByPage(int page, int pageSize, String content) {
	    
         int start=(page-1)*pageSize;
 		List<Room> data=roomMapper.getRoomByPage(start, pageSize, content);
		int count=roomMapper.getTotal(content);
		PageData<Room> pd=new PageData<>(data, count, pageSize, page);
		return pd;
	}
	/**
	 * 修改 
	 */
	/*@Override
	public boolean updateRoom(Room room) {
		// TODO Auto-generated method stub
		return roomMapper.updateByPrimaryKeySelective(room)>0;
	}*/
	@Override
	public Room selectRoomByNo(int roomno) {
		return roomMapper.selectByPrimaryKey(roomno);
	}
	@Override
	public boolean upStatusByRoomno(int roomno,int roomstatus) {
		return roomMapper.upStatusByRoomno(roomno,roomstatus)>0;
	}
	@Override
	public int upsalaryByRoomtype(int roomtype, int roomsalary) {
		// TODO Auto-generated method stub
		return roomMapper.upsalaryByRoomtype(roomtype, roomsalary);
	}

}
